<template>
    <div>
        <!-- 面包屑导航 -->
        <bread></bread>
        <!-- 添加按钮 -->
        <el-button @click="addDialog" plain class="btn" type="primary" size="small">添加</el-button>
        <!-- 表格 -->
        <v-list @edit="edit"></v-list>
        <!-- 弹窗 -->
        <v-dialog ref="dialog" @close="close" :info="info"></v-dialog>
    </div>
</template>

<script>
import vList from './list.vue'
import vDialog from './dialog.vue'
export default {
    data() {
        return {
            info:{
                isShow:false,
                win:true
            }
        };
    },
    components:{
        vList,
        vDialog
    },
    methods:{
        // 添加按钮 控制弹窗显示以及标题
        addDialog(){
            this.info.isShow = true
            this.info.win = true
        },
        // 子组件控制弹窗隐藏
        close(e){
            this.info.isShow = e
        },
        //编辑按钮
        edit(id){
            // 打开弹窗并改变标题为 编辑角色
            this.info.isShow = true
            this.info.win = false
            // 获取子组件的方法，传ID
            this.$refs.dialog.getInfo(id)
        }
    }

};
</script>

<style  lang="less" scoped>
.btn {
  margin: 10px 5px;
}
</style>
